package Level_two;

import java.text.DecimalFormat;
import java.util.Scanner;

public class Two {
    public static void main(String[] args) {
        System.out.println("请输入长方形的长");
        double length = new Scanner(System.in).nextDouble();
        System.out.println("请输入长方形的宽");
        double wide = new Scanner(System.in).nextDouble();
        System.out.println("请输入圆形半径");
        double radius = new Scanner(System.in).nextDouble();
        double area = length * wide;
        double perimeter = 2 * (length + wide);
        //Math.PI代表java中的静态常量
        double area1_center = Math.PI * radius * radius;
        double perimeter1_center = 2 * Math.PI * radius;
        DecimalFormat decimalFormat = new DecimalFormat("#.00");
        System.out.println("长方形的面积是" + decimalFormat.format(area) + "周长是" + decimalFormat.format(perimeter));
        System.out.println("圆形的面积是" + decimalFormat.format(area1_center) + "周长是" + decimalFormat.format(perimeter1_center));
    }
}

